﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;
using System.IO;

namespace SkynetCE.Administration.Views.MgmCategoriesMerge
{
    public partial class MgmCategoriesMergeView : Form, IMgmCategoriesView
    {
        private MgmCategoriesPresenter _Presenter;
        public MgmCategoriesPresenter Presenter
        {
            get
            {
                if (_Presenter == null)
                {
                    this._Presenter = new MgmCategoriesPresenter();
                    this._Presenter.View = this;
                }
                return _Presenter;
            }
        }
        public MgmCategoriesMergeView()
        {
            InitializeComponent();
        }

        private void MgmCategoriesMergeView_Load(object sender, EventArgs e)
        {
            this.Presenter.OnViewReady(); 
        }



        #region IMgmCategoriesView Members

        public List<SkynetCE.Foundation.Model.ExamCategory> Categories
        {
            set {
                this.dgCategories.DataSource = value;
                
            }
        }

        #endregion

        private void menuItem6_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void menuCreate_Click(object sender, EventArgs e)
        {
            this.tabControl1.SelectedIndex = 1; 
            
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var ent = new Foundation.Model.ExamCategory();
            ent.Id = Guid.NewGuid();
            ent.Title = this.txtTitle.Text;
            ent.Description = this.txtDescription.Text;
            this.Presenter.CreateCategory(ent);
        }

        private void menuSync_Click(object sender, EventArgs e)
        {
            this.Presenter.SyncData();

        }

    

    
    }
}